/**
 * @date 10:18:37 AM
 * GroupAPPServiceImpl.java
 * Administrator
 * TODO
 */
package com.qs.education.service.impl;

import org.springframework.stereotype.Service;
import com.qs.education.bean.api.ResponseBean;
import com.qs.education.bean.api.ResponseListBean;
import com.qs.education.bean.beans.EducationGroupResponse;
import com.qs.education.bean.entity.EducationGroup;
import com.qs.education.bean.service.BaseService;
import com.qs.education.service.IGroupAPPService;

/**
 * @class GroupAPPServiceImpl	
 * @author Warren
 * @description
 * @date Nov 8, 2018 
 */
@Service
public class GroupAPPServiceImpl extends BaseService implements IGroupAPPService{

	/**
	 * @author Warren
	 * @param id 群号
	 * @return Map<String,Object>
	 * @description id为群号(10001开始增长)，根据群号搜索班群
	 * @date Nov 9, 2018
	 */
	@Override
	public EducationGroupResponse searchById(Long id) {
		EducationGroupResponse educationGroupResponse = apiCaller.searchGroupById(id);
		return educationGroupResponse;
	}

	/**
	 * @author Warren
	 * @param userId 申请的用户id
	 * @param groupId 申请的班群号
	 * @param sendType 申请类型,教师或学生
	 * @return ResponseBean
	 * @description 申请加入班群
	 * @date Nov 19, 2018
	 */
	@Override
	public ResponseBean apply(Long userId,Long groupId,int sendType) {
		ResponseBean responseBean = apiCaller.applyGroup(userId, groupId, sendType);
		return responseBean;
	}

	/**
	 * @Description 根据teacherID 查询 教师所有的群组
	 * @author Leon
	 * @date   Nov 9, 2018
	 * @param  
	 * @return EducationGroupResponse
	 */
	@Override
	public ResponseListBean<EducationGroupResponse> findGroupByTeacherId(String teacherId) {
		ResponseListBean<EducationGroupResponse> response = apiCaller.findGroupByTeacherId(teacherId);
		return response;
	}

	/**
	 * @Description 创建班群
	 * @author Leon
	 * @date   Nov 12, 2018
	 * @param  
	 * @return EducationGroupResponse
	 */
	@Override
	public EducationGroupResponse createGroups(String params) {
		EducationGroupResponse response = apiCaller.createGroups(params);
		return response;
	}

	/**
	 * @author Warren
	 * @param id 申请班群消息id
	 * @param messageStatus 教师处理结果
	 * @return ResponseBean
	 * @description 教师处理班群申请
	 * @date Nov 13, 2018
	 */
	@Override
	public ResponseBean applyHandle(Long id, int messageStatus) {
		ResponseBean response = apiCaller.applyGroupHandle(id, messageStatus);
		return response;
	}

	/**
	 * @author Warren
	 * @param studentId 学生id
	 * @return ResponseListBean<EducationGroup>
	 * @description 根据学生id获取学生的班群列表
	 * @date Nov 13, 2018
	 */
	@Override
	public ResponseListBean<EducationGroup> findGroupByStudentId(Long studentId) {
		ResponseListBean<EducationGroup> responseListBean = apiCaller.findGroupByStudentId(studentId);
		return responseListBean;
	}

	/**
	 * @author Warren
	 * @param educationStudent 移除学生的id集合 
	 * @return ResponseBean
	 * @description 批量移除学生
	 * @date Nov 13, 2018
	 */
	@Override
	public ResponseBean removeStudents(String[] ids,String groupId) {
		ResponseBean responseBean = apiCaller.removeStudents(ids,groupId);
		return responseBean;
	}

	/**
	 * @Description 移除教师
	 * @author Leon
	 * @date   Nov 13, 2018
	 * @param  
	 * @return EducationGroupResposne
	 */
	@Override
	public EducationGroupResponse removeTeacher(String teacherId,String groupId) {
		EducationGroupResponse response = apiCaller.removeTeacher(teacherId,groupId);
		return response;
	}

	/**
	 * @Description 转让班群
	 * @author Leon
	 * @date   Nov 13, 2018
	 * @param  
	 * @return EducationGroupResponse
	 */
	@Override
	public EducationGroupResponse transferGroup(String teacherId, String groupId) {
		EducationGroupResponse response = apiCaller.transferGroup(teacherId, groupId);
		return response;
	}

	/**
	 * @Description 修改班群信息
	 * @author Leon
	 * @date   Nov 14, 2018
	 * @param  
	 * @return EducationGroupResponse
	 */
	@Override
	public EducationGroupResponse modifyGroup(EducationGroup group) {
		EducationGroupResponse response = apiCaller.modifyGroup(group);
		return response;
	}
	
	/**
	 * @Description 删除群组
	 * @author Leon
	 * @date   Nov 14, 2018
	 * @param  
	 * @return EducationGroupResponse
	 */
	@Override
	public EducationGroupResponse deleteGroupById(String groupId) {
		EducationGroupResponse response = apiCaller.deleteGroupById(groupId);
		return response;
	}
}
